﻿@using System.Drawing
@using MrCMS.Helpers
@using MrCMS.Paging
@using MrCMS.Web.Apps.Articles.Models
@using MrCMS.Web.Apps.Articles.Pages
@model ArticleList     
@Editable(Model, p=>p.BodyContent, true)
@{
    var pagedList = ViewData["paged-articles"] as IPagedList<Article>;
    var searchModel = ViewData["article-search-model"] as ArticleSearchModel;
}
@if (pagedList !=null && !pagedList.Any() && !string.IsNullOrEmpty(searchModel.Category))
{
    <div class="alert alert-info">No posts available in category "@searchModel.Category".</div>
    <p><a href="/@Model.LiveUrlSegment">Show all</a></p>
}
@if (pagedList != null)
{
    foreach (var page in pagedList)
    {
            if (page.PublishOn != null)
            {
    <div class="row">
        <div class="col-lg-12">
            <h3 class="margin-bottom-0"><a href="/@page.LiveUrlSegment">@page.Name </a></h3>
            <span class="small"><strong>@page.PublishOn.Value.Day @page.PublishOn.Value.ToString("MMMMM") @page.PublishOn.Value.Year</strong></span>

            @if (!String.IsNullOrEmpty(page.FeatureImage))
            {
                <div class="left small-margin">
                <a href="/@page.LiveUrlSegment" class="margin-top-0">@RenderImage(page.FeatureImage, new Size{Width = 250})</a>
                    
                </div>
            }

            @Editable(page, p => p.Abstract)

        </div>
    </div>
            }
        }
}
@if (Model.AllowPaging)
{
    @Html.PageCurrentPage(pagedList, i => new { Page = i }, PagedListRenderOptions.PageNumbersOnly)
}